package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
	
	private static final SessionFactory sessionFactory;
    static
    {
        try
        {
        	 AnnotationConfiguration config = new AnnotationConfiguration();
        	 config.addAnnotatedClass(dominio.Articulo.class);
        	 config.addAnnotatedClass(dominio.Cliente.class);
        	 config.addAnnotatedClass(dominio.ItemPedido.class);
        	 config.addAnnotatedClass(dominio.Fabricante.class);
        	 config.addAnnotatedClass(dominio.Importado.class);
        	 config.addAnnotatedClass(dominio.Importador.class);
        	 config.addAnnotatedClass(dominio.Nacional.class);
        	 config.addAnnotatedClass(dominio.Pedido.class);
        	 
             sessionFactory = config.buildSessionFactory();
        }
        catch (Throwable ex)
        {
            System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
        }
    }
    public static SessionFactory getSessionFactory()
    {
        return sessionFactory;
    }

}
